package scuts.core.instances;

import scuts.core.classes.Enumeration;
import utest.Assert;

/**
 * ...
 * @author 
 */

class EnumerationIntTest 
{

  var e:Enumeration<Int>;
  
  public function new() 
  {
    e = EnumerationInt.get;
  }
  
  
  
  public function testSucc() 
  {
    var i = 0;
    
    Assert.equals(1, e.succ(i));
    
  }
  
  public function testPred() 
  {
    var i = 0;
    
    Assert.equals(-1, e.pred(i));
    
  }
  
  public function testFromTo() 
  {
    var i = 0;
    var it = e.enumFromTo(0, 3)();
   
    Assert.isTrue(it.hasNext());
    Assert.equals(0, it.next());
    Assert.isTrue(it.hasNext());
    Assert.equals(1, it.next());
    Assert.isTrue(it.hasNext());
    Assert.equals(2, it.next());
    Assert.isTrue(it.hasNext());
    Assert.equals(3, it.next());
    Assert.isFalse(it.hasNext());
    
  }
  
  public function testFromThenTo() 
  {
    var i = 0;
    var it = e.enumFromThenTo(0, 2, 3)();
   
    Assert.isTrue(it.hasNext());
    Assert.equals(0, it.next());
    Assert.isTrue(it.hasNext());
    Assert.equals(2, it.next());
    Assert.isTrue(it.hasNext());
    Assert.equals(3, it.next());
    Assert.isFalse(it.hasNext());
  }
  
  
}